import { request, post, get } from "@/utils/request";
import ApiResult from "@/api/base/ApiResult";

/**
 * 获取页面列表
 * @returns {promise} Promise
 */
export async function pageList(data: any) {
  const rs: ApiResult<any> = await request(`merchant/page/getPager`, data);
  return rs;
}
/**
 * 新增/编辑页面
 * @returns {promise} Promise
 */
export async function editPage(data: any) {
  const rs: ApiResult<any> = await request("merchant/page/editPage", data);
  return rs;
}
/**
 * 根据活动id获取活动信息
 * @returns {promise} Promise
 */
export async function getActInfos(data: any) {
  const rs: ApiResult<any> = await request("activity/page/getActInfos", data);
  return rs;
}
/**
 * 根据id获取页面配置详情
 * @returns {promise} Promise
 */
export async function getPageInfo(data: any) {
  const rs: ApiResult<any> = await request("merchant/page/getPageInfo", data);
  return rs;
}
/**
 * 根据商品id获取商品详情
 * @returns {promise} Promise
 */
export async function getProDetails(data: any) {
  const rs: ApiResult<any> = await request("activity/page/getProDetails", data);
  return rs;
}
/**
 * 删除
 * @returns {promise} Promise
 */
export async function del(data: any) {
  const rs: ApiResult<any> = await request("merchant/page/delete", data);
  return rs;
}

/**
 * 获取商品分类
 * @returns {promise} Promise
 */
 export async function getAllCategory(data:any) {
  const rs: ApiResult<any> = await request("mall/admin/category/getList",data);
  return rs;
}

/**
 * 获取商品列表
 * @returns {promise} Promise
 */
 export async function getPage(data: any) {
  const rs: ApiResult<any> = await request("mall/admin/product/pageProduct",data);
  return rs;
}

export async function getPage2(data: any) {
  const rs: ApiResult<any> = await request("mall/admin/product/pageProduct2", data);
  return rs;
}
/**
 * 新增/修改商城页面配置
 * @returns {promise} Promise
 */
export async function storePageEdit(data:any):Promise<ApiResult<any>> {
  return request(`merchant/page/editPage`,data);
}

/**
 *
 * @returns {promise} Promise
 */
export async function getStorePage(data:any):Promise<ApiResult<any>> {
  return request(`merchant/page/getPageInfo`,data);
}

export async function productDetail(data:any):Promise<ApiResult<any>> {
  const rs = await request(`/business/mall/goods/getPage`,data);
  return rs;
}

/**
 *根据ids获取上线批次
 * @returns {promise} Promise
 */
export async function getCouponListOnline(data:any):Promise<ApiResult<any>> {
  return request(`mall/admin/product/getProductByIds`,data);
}
